import spawn from 'cross-spawn';
import fs from 'fs-extra';
import { sync } from 'mkdirp';
import path from 'path';

export function run() {
  const name = process?.argv?.slice(2)?.[0];
  if (name) {
    sync(name);
    const cwd = path.join(process.cwd(), name);
    fs.copySync(path.join(__dirname, './config/tpl'), cwd);
    spawn.sync(`qps`, ['spec'], { cwd: cwd, stdio: 'inherit' });
  }
}
